AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')

function ENT:Initialize()
	self.BaseClass.Initialize(self)
	self:GetPhysicsObject():EnableMotion(false)
	self:SetAngles(Angle(-90, 0, 0))
end

function ENT:SpawnFunction(ply, tr)
	if !ply:Alive() then
		Notify(ply,1,3, "Dead men buy no spawn points.")
		return false
	elseif ValidEntity(ply.Spawnpoint) then
		ply.Spawnpoint:Explode()
		Notify(ply,1,3, "Destroyed old spawnpoint to create this one.")
	end
	
	local ent = ents.Create(self.ClassName)
	ent.dt.Owner = ply
	ply.Spawnpoint = ent
	ent:SetPos(ply:GetPos())
	ply:SetPos(ply:GetPos() + Vector(0, 0, 3))
	ent:Spawn()
	
	return ent
end